home *** CD-ROM | disk | FTP | other *** search
- /* datastruct.h */
- /* This file contains the data structure for the internal representation
- of the scene. Also contains several basic datastructures used throughout */
- /* Written by : Jason R. Wilson */
- /* last modified 2/21/93 */
-
-
- #define Wtol 0.0001 /* used for clipping in front of eye */
-
- #define irint rint /* next implementation only */
-
- typedef enum {false , true} Boolean;
-
- /*----------------------------------------------------------------------*/
-
- typedef struct
- {
- double x, y, z;
- }
- Point;
-
- /*----------------------------------------------------------------------*/
-
- typedef struct
- {
- double dx, dy, dz;
- }
- Vector;
-
- /*----------------------------------------------------------------------*/
-
- typedef struct
- {
- double hom[4];
- }
- Homog;
-
- /*----------------------------------------------------------------------*/
-
- typedef struct
- {
- double mat[16];
- }
- Matrix;
-
- /*----------------------------------------------------------------------*/
-
- typedef struct
- {
- unsigned char r,g,b;
- }
- UColor;
-
- /*----------------------------------------------------------------------*/
-
- typedef struct
- {
- double r,g,b;
- }
- Color;
-
- /*----------------------------------------------------------------------*/
-
- typedef struct
- {
- double Wl,Wr,Wb,Wt;
- }
- Window;
-
- /*----------------------------------------------------------------------*/
-
- typedef struct vertexlistcell /* stores a pointer to a vertex */
- {
- struct vertexcell *Vertex;
- struct vertexlistcell *Rest;
- }
- VertexListCell;
-
- /*----------------------------------------------------------------------*/
-
- typedef struct polygonlistcell /* stores a pointer to a polygon */
- {
- struct polygoncell *Polygon;
- struct polygonlistcell *Rest;
- }
- PolygonListCell;
-
- /*----------------------------------------------------------------------*/
-
- typedef struct visvertexcell
- {
- Color B; /* the color of the vertex */
- Homog ViewPosition; /* the view position */
- struct visvertexcell *Next;
- }
- VisVertexCell;
-
- /*----------------------------------------------------------------------*/
-
- typedef struct polygoncell
- {
- struct vertexlistcell *Vertices; /* The vertices of the polygon */
- VisVertexCell *VisVertices; /* The visible vertices */
- Vector Normal; /* The polygon normal */
- struct polygoncell *Next;
- struct polygoncell *Subs[4];
- int ID; /* unique identifier for polygon */
- Boolean Textured; /* is it a textured polygon */
- Color B; /* the radiosity (color) of the polygon */
- Color R; /* the reflectivity of the cell */
- Color E; /* the emmission values for the cell */
- Boolean Culled; /* has the poly been culled? */
- }
- PolygonCell;
-
-
- /*----------------------------------------------------------------------*/
- typedef struct vertexcell
- {
- Point WorldPosition; /* the world coordinates */
- Homog ViewPosition; /* the view coord. */
- Vector Normal; /* the vertex normal */
- int Number;
- double Intensity;
- struct polygonlistcell *Polygons; /*The polygons that contain this vertex */
- struct vertexcell *Next;
- Color B;
- }
- VertexCell;
-
- /*----------------------------------------------------------------------*/
-
- typedef struct objectcell
- {
- int Number; /* uniquely identifies the object */
- Color **TextureMap; /* contains the texture map if the object is textured */
- int mapHeight,mapWidth; /* texture info. (see above) */
- int NoofVertices, NoofPolygons; /* Number of vertices and polygons */
- VertexCell *VertexHead; /* The list of vertices for the object */
- PolygonCell *PolygonHead; /* The list of polygons for the object */
- Matrix Transform; /* The transform matrix for the object */
- Matrix InverseTransform; /* the inverse transform matrix for the object */
- struct objectcell *Next; /* the next object in the list */
- int SubFactor; /* specifies how many times the initial mesh should be subdivided */
- Boolean ShouldAdapt; /* should this object be adaptively subdivided */
- }
- ObjectCell;
-
- ObjectCell *ObjectHead; /* declare here for all to see */
-
- void InitVertexListCell (VertexListCell *VertList);
- void InitPolygonListCell (PolygonListCell *PolyList);
- void InitVisVertexCell (VisVertexCell *VisVert);
- void InitPolygonCell (PolygonCell *Poly);
- void InitVertexCell (VertexCell *Vert);
- void InitObjectCell (ObjectCell *Object);
-
-
-
-
-
-
-
-